package com.briup.cms.service.impl;

import com.briup.cms.bean.Notes;
import com.briup.cms.dao.NotesMapper;
import com.briup.cms.service.INotesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: cms
 * @description:
 * @author: charles
 * @create: 2020-07-02 09:40
 **/
@Service
public class NotesServiceImpl implements INotesService {
    @Resource
    private NotesMapper notesMapper;

    @Override
    public List<Notes> findAll() {
        return notesMapper.selectAll();
    }
    @Override
    public void saveOrUpdate(Notes notes){
        if (notes.getId()!=null)
            notesMapper.update(notes);
        else{
            notesMapper.insert(notes);
        }
    }
    @Override
    public void deleteById(long id){
        notesMapper.deleteById(id);
    }
}
